<div class="step_item step_item_1" style="display:block;">
    <form>
        <div class="ui_table" style="height:100%; width:100%;">
            <table cellpadding="0" cellspacing="0" height="100%" width="100%">
                <tr>
                    <td width="170" align="right">策略名称：</td>
                    <td><input type="text" class="text easyui-validatebox" name="strategyName" maxlength="10"
                               required="true"
                               style="width:300px;"/></td>
                </tr>
            <#if Session['SESSION_KEY_USER'].type == Session['USER_TYPE_PLATFORM'].value>
                <tr>
                    <td align="right">运营商：</td>
                    <td>
                        <input name="agentId" class="easyui-combotree" editable="false"
                               style="width: 184px; height: 28px;" required="required"
                               data-options="url:'${contextPath}/security/basic/agent/tree.htm',method:'get',required:true,onSelect: function(rec){
                               var url = '${contextPath}/security/hdw/agency/tree.htm?agentId='+rec.id;
                               $('#agency_id_${pid}').combotree('reload', url);},
                               onChange:function(){
                                $('#agency_id_${pid}').combotree('clear');
                               }"/>
                    </td>
                </tr>
            <#else>
                <input type="hidden" name="agentId" value="${Session['SESSION_KEY_USER'].agentId}">
            </#if>
            <#if Session['SESSION_KEY_USER'].type == Session['USER_TYPE_AGENT'].value||Session['SESSION_KEY_USER'].type == Session['USER_TYPE_PLATFORM'].value>
                <tr>
                    <td align="right">代理商：</td>

                    <td>
                        <input name="agencyId" class="easyui-combotree" editable="false" required="required"
                               style="width: 184px; height: 28px;" id="agency_id_${pid}"
                               data-options="<#if Session['SESSION_KEY_USER'].agentId??&&Session['SESSION_KEY_USER'].agentId!=0>url:'${contextPath}/security/hdw/agency/tree.htm?agentId=${Session['SESSION_KEY_USER'].agentId}',</#if>method:'get',required:true,"/>
                    </td>
                </tr>
            <#else>
                <input type="hidden" name="agencyId" value="${Session['SESSION_KEY_USER'].agencyId}">
            </#if>
            </table>
        </div>
    </form>
</div>
<script>
    (function () {
        var win = $('#${pid}');
        var container = win.find('.step_item_1');
        var form = win.find('form');
        var showValue = function () {
            var values = win.data('values');
            container.find('input[name=strategyName]').val(values.strategyName);
            container.find('input[name=agentId]').val(values.agentId);
            container.find('input[name=agencyId]').val(values.agencyId);
//            $("#select_agencyId option").each(function(i,n){
//                if($(n).val()==values.agencyId)
//                {
//                    $(n).attr("selected",true);
//                }
//            })
        }
        var collectValue = function () {
            var values = win.data('values');
            values.strategyName = container.find('input[name=strategyName]').val();
            values.agencyId = container.find('input[name=agencyId]').val();
            values.agentId = container.find('input[name=agentId]').val();
            return form.form('validate');
        }

        win.data('showValue1', showValue);
        win.data('collectValue1', collectValue);
    })();
</script>